<template>
    <div>
        <!-- 加做特殊染色弹窗 -->
        <el-dialog
            :close-on-click-modal="false"
            title="选择特殊染色"
            :visible.sync="addstainingdialog"
            width="90%"
            :modal-append-to-body="false"
            :append-to-body="true"
            @close="closestainingdialog"
        >
            <div style="height: 300px">
                <template>
                    <div style="
              float: left;
              width: 48%;
              height: 320px;
              border-bottom: 1px solid #ccc;
              border-left: 1px solid #ccc;
              border-top: 1px solid #ccc;
            ">
                        <div>
                            <div style="margin-left: 10px">
                                <div style="padding-top: 5px">
                                    <el-input
                                        style="float: left; width: 50%"
                                        size="mini"
                                        v-model="staningkeySearch"
                                        placeholder="输入关键字……"
                                        clearable
                                    ></el-input>
                                    <el-button
                                        @click="addDyeingHandelClick"
                                        type="primary"
                                        style="margin-left: 5px"
                                        size="mini"
                                    >搜索</el-button>
                                </div>
                                <div style="margin-top: 20px; height: 250px; overflow-y: auto; margin-bottom: 12px">
                                    <template>
                                        <el-checkbox-group
                                            class="checkbox"
                                            v-model="checkedstaning"
                                            @change="handleCheckedstaningChange"
                                        >
                                            <el-checkbox
                                                style="display: block; margin-left: 30px; line-height: 20px"
                                                v-for="(item, index) in staningDatas"
                                                :label="item.id"
                                                :key="index"
                                            >
                                                <div>
                                                    <div
                                                        class="limit-text"
                                                        :title="item.name"
                                                    >
                                                        {{ item.name }}
                                                    </div>
                                                    <div class="limit-count-text">价格:{{ item.cost }}元</div>
                                                </div>
                                            </el-checkbox>
                                        </el-checkbox-group>
                                    </template>
                                </div>
                            </div>
                        </div>
                    </div>
                </template>
                <template>
                    <div style="
              float: left;
              width: 48%;
              height: 320px;
              border-bottom: 1px solid #ccc;
              border-left: 1px solid #ccc;
              border-right: 1px solid #ccc;
            ">
                        <div style="
                height: 38px;
                line-height: 38px;
                border-top: 1px solid #ccc;
                border-bottom: 1px solid #ccc;
              ">
                            <span>已选项目</span><span style="margin-left: 15px">总计:{{ staningPriceTotal }}元</span>
                        </div>
                        <div style="margin-top: 20px; margin-left: 10px">
                            <div style="height: 32px; line-height: 32px">
                                <div style="height: 32px; float: left; line-height: 32px">单项</div>
                            </div>
                            <ul style="height: 176px; overflow-y: auto; margin-bottom: 12px">
                                <li
                                    :key="item.id"
                                    v-for="item in staningDatasCopy"
                                >
                                    <span class="limit-text">{{ item.name }}</span>
                                    <span>价格:{{ item.cost }}元</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </template>
            </div>
            <span
                slot="footer"
                class="dialog-footer"
            >
                <el-button
                    size="mini"
                    @click="addstainingdialog = false"
                >取 消</el-button>
                <el-button
                    size="mini"
                    @click="addType('staining')"
                    type="primary"
                >确 定</el-button>
            </span>
        </el-dialog>
        <!-- 加做信息 分子病理弹窗-->
        <el-dialog
            :close-on-click-modal="false"
            title="选择分子病理"
            :visible.sync="addmolecular"
            width="90%"
            :modal-append-to-body="false"
            :append-to-body="true"
            @close="closemolecular"
        >
            <div style="height: 300px">
                <template>
                    <div style="
              float: left;
              width: 48%;
              height: 320px;
              border-bottom: 1px solid #ccc;
              border-left: 1px solid #ccc;
              border-top: 1px solid #ccc;
            ">
                        <el-tabs
                            v-model="addmolecularName"
                            @tab-click="molecularhandleClick"
                        >
                            <el-tab-pane
                                label="套餐"
                                name="first"
                            >
                                <div>
                                    <div style="margin-left: 10px">
                                        <div style="margin-top: 20px; height: 240px; overflow-y: auto; margin-bottom: 12px">
                                            <template>
                                                <el-checkbox-group
                                                    class="checkbox"
                                                    v-model="molecularChecked"
                                                    @change="handleCheckedmolecularChange"
                                                >
                                                    <el-checkbox
                                                        style="display: block; margin-left: 30px; line-height: 20px"
                                                        v-for="(item, index) in molecularAll"
                                                        :label="item.id"
                                                        :key="index"
                                                    >
                                                        <div>
                                                            <div
                                                                class="limit-text"
                                                                :title="item.name"
                                                            >
                                                                {{ item.name }}
                                                            </div>
                                                            <div class="limit-count-text">价格:{{ item.discount }}元</div>
                                                        </div>
                                                    </el-checkbox>
                                                </el-checkbox-group>
                                            </template>
                                        </div>
                                    </div>
                                </div>
                            </el-tab-pane>
                            <el-tab-pane
                                label="单项"
                                name="second"
                            >
                                <div>
                                    <div style="margin-left: 10px">
                                        <!-- <div style="padding-top: 5px;">
                                            <el-input style="float: left; width: 50%;" size="mini"
                                                      v-model="molecularPkgSearchKey"
                                                      placeholder="输入关键字……"
                                                      clearable></el-input>
                                            <el-button @click="molecularPkgSearchByName"
                                            type="primary" style="margin-left: 5px" size="mini">
                                            搜索</el-button>
                                        </div> -->
                                        <div style="margin-top: 20px; height: 200px; overflow-y: auto; margin-bottom: 12px">
                                            <template>
                                                <!-- <el-checkbox
                                                :indeterminate="staningisIndeterminate"
                                                v-model="staningcheckAll"
                                                @change="staninghandleCheckAllChange">全选
                                                </el-checkbox>
                                                <div style="margin: 15px 0;"></div> -->
                                                <el-checkbox-group
                                                    class="checkbox"
                                                    v-model="molecularCheckedDataCopyIdS"
                                                    @change="molecularSubCheckedChange"
                                                >
                                                    <el-checkbox
                                                        style="display: block; margin-left: 30px; line-height: 20px"
                                                        v-for="(item, index) in molecularSubData"
                                                        :label="item.id"
                                                        :key="index"
                                                    >
                                                        <div>
                                                            <div
                                                                class="limit-text"
                                                                :title="item.name"
                                                            >
                                                                {{ item.name }}
                                                            </div>
                                                            <div class="limit-count-text">价格:{{ item.cost }}元</div>
                                                        </div>
                                                    </el-checkbox>
                                                </el-checkbox-group>
                                            </template>
                                        </div>
                                    </div>
                                </div>
                            </el-tab-pane>
                        </el-tabs>
                    </div>
                </template>
                <template>
                    <div style="
              float: left;
              width: 48%;
              height: 320px;
              border-bottom: 1px solid #ccc;
              border-left: 1px solid #ccc;
              border-right: 1px solid #ccc;
            ">
                        <div style="
                height: 38px;
                line-height: 38px;
                border-top: 1px solid #ccc;
                border-bottom: 1px solid #ccc;
              ">
                            <span>已选项目</span><span style="margin-left: 15px">总计:{{ moleculaTotal }}元</span>
                        </div>
                        <div style="margin-left: 10px">
                            <div style="height: 32px; line-height: 32px">
                                <div style="height: 32px; float: left; line-height: 32px">单项</div>
                            </div>
                            <ul style="height: 210px; overflow-y: auto; margin-bottom: 12px">
                                <li
                                    :key="index"
                                    v-for="(item, index) in molecularCheckedDataCopy"
                                >
                                    <span class="limit-text">{{ item.name }}</span>
                                    <span>价格:{{ item.cost }}元</span>
                                    <span
                                        v-if="addmolecularName === 'first'"
                                        style="margin-left: 20px; color: #00f; cursor: pointer"
                                        @click="decmolecularItem(item.id)"
                                    >删除</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </template>
            </div>
            <span
                slot="footer"
                class="dialog-footer"
            >
                <el-button
                    size="mini"
                    @click="addmolecular = false"
                >取 消</el-button>
                <el-button
                    size="mini"
                    @click="addType('molecular')"
                    type="primary"
                >确 定</el-button>
            </span>
        </el-dialog>

        <!-- 加做信息 免疫组化弹窗-->
        <el-dialog
            :close-on-click-modal="false"
            title="选择免疫组化"
            :visible.sync="addImmunohistochemistry"
            width="90%"
            :modal-append-to-body="false"
            :append-to-body="true"
            @close="closeImmunohistochemistry"
        >
            <div style="height: 300px">
                <template>
                    <div style="
              float: left;
              width: 48%;
              height: 320px;
              border-bottom: 1px solid #ccc;
              border-left: 1px solid #ccc;
              border-top: 1px solid #ccc;
            ">
                        <el-tabs
                            v-model="addImmunohistochemistryactiveName"
                            @tab-click="inchandleClick"
                        >
                            <el-tab-pane
                                label="套餐"
                                name="first"
                            >
                                <div>
                                    <div style="margin-left: 10px">
                                        <div style="margin-top: 20px; height: 240px; overflow-y: auto; margin-bottom: 12px">
                                            <template>
                                                <el-checkbox-group
                                                    class="checkbox"
                                                    v-model="ihcChecked"
                                                    @change="handleCheckedIhcChange"
                                                >
                                                    <el-checkbox
                                                        style="display: block; margin-left: 30px; line-height: 20px"
                                                        v-for="(item, index) in ihcAll"
                                                        :label="item.id"
                                                        :key="index"
                                                    >
                                                        <div>
                                                            <div
                                                                class="limit-text"
                                                                :title="item.name"
                                                            >
                                                                {{ item.name }}
                                                            </div>
                                                            <div class="limit-count-text">价格:{{ item.cost }}元</div>
                                                        </div>
                                                    </el-checkbox>
                                                </el-checkbox-group>
                                            </template>
                                        </div>
                                    </div>
                                </div>
                            </el-tab-pane>
                            <el-tab-pane
                                label="单项"
                                name="second"
                            >
                                <div>
                                    <div style="margin-left: 10px">
                                        <div style="padding-top: 5px">
                                            <el-input
                                                style="float: left; width: 50%"
                                                size="mini"
                                                v-model="ihcPkgSearchKey"
                                                placeholder="输入关键字……"
                                                clearable
                                            ></el-input>
                                            <el-button
                                                @click="inchandleClick"
                                                type="primary"
                                                style="margin-left: 5px"
                                                size="mini"
                                            >搜索</el-button>
                                        </div>
                                        <div style="margin-top: 20px; height: 200px; overflow-y: auto; margin-bottom: 12px">
                                            <template>
                                                <!-- <el-checkbox
                                                :indeterminate="staningisIndeterminate"
                                                v-model="staningcheckAll"
                                                @change="staninghandleCheckAllChange">全选
                                                </el-checkbox>
                                                <div style="margin: 15px 0;"></div> -->
                                                <el-checkbox-group
                                                    class="checkbox"
                                                    v-model="ihcCheckedDataCopyIdS"
                                                    @change="ihcSubCheckedChange"
                                                >
                                                    <el-checkbox
                                                        style="display: block; margin-left: 30px; line-height: 20px"
                                                        v-for="(item, index) in ihcSubData"
                                                        :label="item.id"
                                                        :key="index"
                                                    >
                                                        <div>
                                                            <div
                                                                class="limit-text"
                                                                :title="item.name"
                                                            >
                                                                {{ item.name }}
                                                            </div>
                                                            <div class="limit-count-text">价格:{{ item.cost }}元</div>
                                                        </div>
                                                    </el-checkbox>
                                                </el-checkbox-group>
                                            </template>
                                        </div>
                                    </div>
                                </div>
                            </el-tab-pane>
                        </el-tabs>
                    </div>
                </template>
                <template>
                    <div style="
              float: left;
              width: 48%;
              height: 320px;
              border-bottom: 1px solid #ccc;
              border-left: 1px solid #ccc;
              border-right: 1px solid #ccc;
            ">
                        <div style="
                height: 38px;
                line-height: 38px;
                border-top: 1px solid #ccc;
                border-bottom: 1px solid #ccc;
              ">
                            <span>已选项目</span><span style="margin-left: 15px">总计:{{ ihcTotal }}元</span>
                        </div>
                        <div style="margin-left: 10px">
                            <div style="height: 32px; line-height: 32px">
                                <div style="height: 32px; float: left; line-height: 32px">单项</div>
                            </div>
                            <ul style="height: 210px; overflow-y: auto; margin-bottom: 12px">
                                <li
                                    :key="index"
                                    v-for="(item, index) in ihcCheckedDataCopy"
                                >
                                    <span class="limit-text">{{ item.name }}</span>
                                    <span>价格:{{ item.cost }}元</span>
                                    <span
                                        v-if="addImmunohistochemistryactiveName === 'first'"
                                        style="margin-left: 20px; color: #00f; cursor: pointer"
                                        @click="decIncItem(item.id)"
                                    >删除</span>
                                </li>
                            </ul>
                        </div>
                    </div>
                </template>
            </div>
            <span
                slot="footer"
                class="dialog-footer"
            >
                <el-button
                    size="mini"
                    @click="addImmunohistochemistry = false"
                >取 消</el-button>
                <el-button
                    size="mini"
                    @click="addType('ihc')"
                    type="primary"
                >确 定</el-button>
            </span>
        </el-dialog>
    </div>
</template>

<script>
/**
 * author：duyanzhao
 */

// import moment from 'moment';

export default {
  name: 'ConsultationPlusCopy',
  components: {},
  props: ['orderId', 'opinionTabActive', 'orders'],
  data() {
    return {
      TransferDataKey: {},
      suggesstionStaining: [],
      staining: [],
      molecularDetial: [],
      //参与人员
      participateMeetDataIng: [],
      imgURL: '',
      TransferData: '',
      // 查看加做信息相关
      addItemCheckTab: 'addDyeing',
      imageURL: process.env.VUE_APP_ImageServiceURL, // 图片上传地址:
      showUploadData: false,
      lookshowUploadData: false,
      dialogVisible: false,
      dialogImages: [],
      // 特殊染色弹窗
      addstainingdialog: false,
      staningkeySearch: '',
      staningisIndeterminate: true,
      staningcheckAll: false,
      checkedstaning: [],
      staningDatas: [],
      staningDatasCopy: [],
      staningPriceTotal: 0,
      // 分子病理弹窗相关属性
      addmolecular: false,
      addmolecularName: 'first',
      molecularChecked: [],
      molecularAll: [],
      molecularCheckedDataCopy: [],
      molecularCheckedDataCopyIdS: [],
      molecularSubData: [],
      molecularDataIng: [],
      molecularPkgSearchKey: '',
      // 免疫组化弹窗相关属性
      addImmunohistochemistry: false,
      addImmunohistochemistryactiveName: 'first',
      ihcChecked: [],
      ihcAll: [],
      ihcCheckedDataCopy: [],
      ihcCheckedDataCopyIdS: [],
      ihcSubData: [],
      ihcDataIng: [],
      ihcPkgSearchKey: ''
    }
  },

  mounted() {},

  computed: {
    ihcData() {
      const data = []
      if (this.ihcDataIng.length > 0) {
        this.ihcDataIng.forEach(item => {
          let statusName = ''
          if (item.resultUrl) {
            statusName = '已上传'
          } else {
            statusName = '未上传'
          }
          data.push({
            projectName: item.doctorAdviceName,
            ids: item.id,
            url: item.resultUrl,
            statusName,
            specialistId: item.applyDoctorName,
            submitDate: item.createTime,
            type: 'ihc',
            status: item.status == 0 ? '正常' : item.status == 1 ? '机构做' : '已付款',
            result: item.result
          })
        })
      }
      return data
    },
    personAuth() {
      let auth = 'doctor'
      return auth
    },
    moleculaTotal() {
      let price = 0
      if (this.molecularCheckedDataCopy.length > 0) {
        this.molecularCheckedDataCopy.forEach(temp => {
          price += temp.cost
        })
      }
      return price
    },
    ihcTotal() {
      let price = 0
      if (this.ihcCheckedDataCopy.length > 0) {
        this.ihcCheckedDataCopy.forEach(temp => {
          price += temp.cost
        })
      }
      return price
    }
  },
  methods: {
    //关闭特殊染色dialog
    closestainingdialog() {
      this.checkedstaning = []
      this.staningDatasCopy = []
    },
    //关闭分子病理dialog
    closemolecular() {
      this.molecularChecked = []
      this.molecularCheckedDataCopyIdS = []
      this.molecularCheckedDataCopy = []
    },
    //关闭免疫组化dialog
    closeImmunohistochemistry() {
      this.ihcChecked = []
      this.ihcCheckedDataCopyIdS = []
      this.ihcCheckedDataCopy = []
    },
    //备注保存
    saveRemark(row) {
      let _this = this
      try {
        this.$axios({
          method: 'put',
          url: '/diagnosis/extra-project',
          data: { id: row.ids, result: row.result }
        }).then(
          res => {
            if (res.data.code === 200) {
              _this.$message.info('保存成功')
              // this[this.TransferDataKey].forEach((n, i) => {
              //   if (n.id == _this.TransferData) {
              //     this.$set(this[this.TransferDataKey][i], 'resultUrl', _this.imgURL + '|')
              //   }
              // })
            }
          },
          err => {
            this.$message.info(`${err.response.data}`)
          }
        )
      } catch (e) {
        console.log('请求失败')
      }
    },
    // 分子病理
    molecularhandleClick(tab) {
      if (tab.label === '单项') {
        try {
          this.$axios({
            method: 'POST',
            url: `/doctor-advices/findAllDoctorAdvice`,
            data: {
              name: this.molecularPkgSearchKey,
              type: 2,
              size: 100,
              page: 0
            }
          }).then(
            res => {
              if (res.data.code === 200) {
                // 设置数据列表
                this.molecularSubData = res.data.data
              }
            },
            err => {
              this.$message.info(err.response.data)
            }
          )
        } catch (e) {
          console.log('请求失败')
        }
      }
    },

    // 获取分子病理
    addMolecularHandelClick() {
      try {
        this.$axios({
          method: 'get',
          url: '/doctor-advice-packages?name=&type=2&size=1000&page=0'
        }).then(
          res => {
            if (res.data.code === 200) {
              // 设置数据列表
              this.molecularAll = res.data.data
              this.addmolecular = true
            }
          },
          err => {
            this.$message.info(err.response.data)
          }
        )
      } catch (e) {
        console.log('请求失败')
      }
    },
    handleCheckedmolecularChange(val) {
      this.molecularCheckedDataCopy = []
      this.molecularCheckedDataCopyIdS = []
      if (val.length > 0) {
        val.forEach(id => {
          this.molecularAll.forEach(eid => {
            if (eid.id === id) {
              eid.doctorAdviceList.forEach(temp => {
                this.molecularCheckedDataCopy.push(temp)
                this.molecularCheckedDataCopyIdS.push(temp.id)
              })
            }
          })
        })
      }
    },
    molecularSubCheckedChange(val) {
      this.molecularCheckedDataCopy = []
      this.molecularSubData.forEach(item => {
        val.forEach(temp => {
          if (temp === item.id) {
            this.molecularCheckedDataCopy.push(item)
          }
        })
      })
    },
    decmolecularItem(val) {
      if (this.molecularCheckedDataCopy.length === 1) {
        this.molecularCheckedDataCopy = []
      } else {
        for (let i = 0; i < this.molecularCheckedDataCopy.length - 1; i++) {
          if (this.molecularCheckedDataCopy[i].id === val) {
            this.molecularCheckedDataCopy.splice(i, 1)
          }
        }
      }
    },
    addMesHandleClick() {
      this.dialogImages = []
    },
    // 免疫组化
    addIncHandelClick() {
      try {
        this.$axios({
          method: 'get',
          url: '/doctor-advice-packages?name=&type=3&size=1000&page=0'
        }).then(
          res => {
            if (res.data.code === 200) {
              // 设置数据列表
              this.ihcAll = res.data.data
              this.addImmunohistochemistry = true
            }
          },
          err => {
            this.$message.info(err.response.data)
          }
        )
      } catch (e) {
        console.log('请求失败')
      }
    },
    inchandleClick(tab) {
      if (tab.label === '单项') {
        // 请求查询接口
        try {
          this.$axios({
            method: 'POST',
            url: `/doctor-advices/findAllDoctorAdvice`,
            data: {
              name: this.ihcPkgSearchKey,
              type: 3,
              size: 100,
              page: 0
            }
          }).then(
            res => {
              if (res.data.code === 200) {
                // 设置数据列表
                this.ihcSubData = res.data.data
              }
            },
            err => {
              this.$message.info(err.response.data)
            }
          )
        } catch (e) {
          console.log('请求失败')
        }
      }
    },
    handleCheckedIhcChange(val) {
      this.ihcCheckedDataCopy = []
      this.ihcCheckedDataCopyIdS = []
      if (val.length > 0) {
        val.forEach(id => {
          this.ihcAll.forEach(eid => {
            if (eid.id === id) {
              eid.doctorAdviceList.forEach(temp => {
                this.ihcCheckedDataCopy.push(temp)
                this.ihcCheckedDataCopyIdS.push(temp.id)
              })
            }
          })
        })
      }
    },
    ihcPkgSearchByName() {},
    ihcSubCheckedChange(val) {
      this.ihcCheckedDataCopy = []
      this.ihcSubData.forEach(item => {
        val.forEach(temp => {
          if (temp === item.id) {
            this.ihcCheckedDataCopy.push(item)
          }
        })
      })
    },
    decIncItem(val) {
      if (this.ihcCheckedDataCopy.length === 1) {
        this.ihcCheckedDataCopy = []
      } else {
        for (let i = 0; i < this.ihcCheckedDataCopy.length - 1; i++) {
          if (this.ihcCheckedDataCopy[i].id === val) {
            this.ihcCheckedDataCopy.splice(i, 1)
          }
        }
      }
    },
    // 处理加做项目数据
    processingData(id, list = []) {
      return list
        .filter(n => n.applyDoctorId == id)
        .reduce(
          (arr, n) => {
            arr[Number(n.type) - 1].push({ ...n })
            return arr
          },
          [[], [], []]
        )
    },

    // 获取特殊医嘱
    getmedicalorder(list = []) {
      const [arr1, arr2, arr3] = this.processingData(this.opinionTabActive, list)
      this.staining = arr1
      this.molecularDetial = arr2
      this.ihcDataIng = arr3
      let arrList = []
      arr1.forEach(item => {
        arrList.push(item)
      })
      arr2.forEach(item => {
        arrList.push(item)
      })
      arr3.forEach(item => {
        arrList.push(item)
      })
      this.$emit('addPlus', arrList)
    },

    itemCheck(item, key) {
      console.log(key)
      this.showUploadData = true
      this.TransferData = item.ids
      this.TransferDataKey = key
      if (item.url) {
        this.clearUploadFiles()
        this.dialogImages = []
        const imgList = item.url.split('|')
        const formatList = imgList.slice(0, imgList.length - 1)
        formatList.forEach(ele => {
          this.dialogImages.push({ name: 'img', url: this.imageURL + ele })
        })
      }

      //   if (item.image) {
      //     this.dialogImages = item.images;
      //   }
    },

    addDyeingHandelClick() {
      try {
        this.$axios({
          method: 'POST',
          url: `/doctor-advices/findAllDoctorAdvice`,
          data: {
            name: this.staningkeySearch,
            type: 1,
            size: 100,
            page: 0
          }
        }).then(
          res => {
            if (res.data.code === 200) {
              // 设置数据列表
              this.staningDatas = res.data.data
              // 初始化已经选择的
              if (this.staining.length > 0) {
                const tempdata = []
                this.staining.forEach(item => {
                  tempdata.push(item.id)
                })
                this.checkedstaning = tempdata
                this.handleCheckedstaningChange(tempdata)
              }
            }
            this.addstainingdialog = true
          },
          err => {
            this.$message.info(err.response.data)
          }
        )
      } catch (e) {
        console.log('请求失败')
      }
    },
    handleCheckedstaningChange(value) {
      this.staningDatasCopy = []
      if (this.staningDatas) {
        this.staningDatas.forEach(item => {
          value.forEach(temp => {
            if (item.id === temp) {
              this.staningDatasCopy.push(item)
            }
          })
        })
      }
      let staningPriceTotal = 0
      this.staningDatasCopy.forEach(item => {
        staningPriceTotal = item.cost + staningPriceTotal
      })

      this.staningPriceTotal = staningPriceTotal
      const checkedCount = value.length
      this.staningcheckAll = checkedCount === this.staningDatas.length
      this.staningisIndeterminate = checkedCount > 0 && checkedCount < this.staningDatas.length
    },
    cancelToUpload() {
      this.clearUploadFiles()
      this.showUploadData = false
    },
    clearUploadFiles() {
      if (this.personAuth === 'doctor') {
        this.$refs.addItemDataUpload.clearFiles()
      }
    },
    changeImages(file, fileList) {
      this.imgURL = ''
      if (file.status === 'success') {
        fileList.forEach(ele => {
          if (ele.response) {
            this.imgURL += `${ele.response.url.slice(ele.response.url.indexOf('_') - 1)}|`
          } else {
            this.imgURL += `${ele.url.slice(ele.url.indexOf('_') - 1)}|`
          }
        })
      }
    },
    addType(type) {
      let finallyData = []
      const words = []
      if (type === 'staining') {
        finallyData = this.staningDatasCopy
        this.staningDatasCopy.forEach(temp => {
          words.push(temp.id)
        })
      }
      if (type === 'ihc') {
        finallyData = this.ihcCheckedDataCopy
        this.ihcCheckedDataCopy.forEach(temp => {
          words.push(temp.id)
        })
      }
      if (type === 'molecular') {
        finallyData = this.molecularCheckedDataCopy
        this.molecularCheckedDataCopy.forEach(temp => {
          words.push(temp.id)
        })
      }
      if (finallyData.length > 0) {
        this.$emit('addPlus', finallyData)
        this.addstainingdialog = false
        this.addmolecular = false
        this.addImmunohistochemistry = false
      } else {
        this.$message({
          message: '请选择加做项目',
          type: 'warning'
        })
      }
    }
  }
}
</script>

<style scoped>
.limit-text {
  width: 320px;
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.limit-count-text {
  display: inline-block;
  vertical-align: middle;
}
</style>
